<!DOCTYPE html>
<html>
  <head>
    <title><%= content_for(:title) || "Blog" %></title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="mobile-web-app-capable" content="yes">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= yield :head %>

<!--    <link rel="manifest" href="/manifest.json">-->
    <link rel="icon" href="/icon.png" type="image/png">
    <link rel="icon" href="/icon.svg" type="image/svg+xml">
    <link rel="apple-touch-icon" href="/icon.png">
    <link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= javascript_include_tag "turbo", type: "module" %> <%# 增加这一行，可以解决turbo-method: :delete无效的问题 %>
  </head>

  <body>
    <div style="color:#f00">
      <%= "#{flash[:notice]}" %>
    </div>
    <ul>
      <li>
        <a href="/">Home</a>
      </li>
      <% if session[:user_id] %>
        <li><%= link_to "#{User.find(session[:user_id]).name}，退出", session_path(User.find(session[:user_id])), data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %></li>
      <% else %>
        <li><%= link_to "登录", new_session_path %></li>
      <% end -%>
    </ul>
    <%= yield %>
  </body>
</html>
